package com.top4create.model;

import com.top4create.model.BaseObject;

import org.compass.annotations.Searchable;
import org.compass.annotations.SearchableComponent;
import org.compass.annotations.SearchableId;
import org.compass.annotations.SearchableProperty;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;

import javax.xml.bind.annotation.XmlRootElement;

import java.io.Serializable;

@Entity
@Table(name="sell_info",catalog="top4create_test")
@Searchable
@XmlRootElement
public class SellInfo extends BaseObject implements Serializable {
    private Long id;
    private Company company;
    private String bugType;
    private Long createtime;
    private String description;
    private String logos;
    private String other;
    private Long persisttime;
    private String style;
    private String style1;
    private String useby;
    private Set<FavourateSell> favourateSells = new HashSet<FavourateSell>(0);

    @Id @GeneratedValue(strategy=IDENTITY) @SearchableId    
    public Long getId() {
        return this.id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }
@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="com_id")
    public Company getCompany() {
        return this.company;
    }
    
    public void setCompany(Company company) {
        this.company = company;
    }
    
    @Column(name="bug_type", length=30)
    @SearchableProperty
    public String getBugType() {
        return this.bugType;
    }
    
    public void setBugType(String bugType) {
        this.bugType = bugType;
    }
    
    @Column(name="createtime")
    @SearchableProperty
    public Long getCreatetime() {
        return this.createtime;
    }
    
    public void setCreatetime(Long createtime) {
        this.createtime = createtime;
    }
    
    @Column(name="description", length=300)
    @SearchableProperty
    public String getDescription() {
        return this.description;
    }
    
    public void setDescription(String description) {
        this.description = description;
    }
    
    @Column(name="logos", length=100)
    @SearchableProperty
    public String getLogos() {
        return this.logos;
    }
    
    public void setLogos(String logos) {
        this.logos = logos;
    }
    
    @Column(name="other", length=200)
    @SearchableProperty
    public String getOther() {
        return this.other;
    }
    
    public void setOther(String other) {
        this.other = other;
    }
    
    @Column(name="persisttime")
    @SearchableProperty
    public Long getPersisttime() {
        return this.persisttime;
    }
    
    public void setPersisttime(Long persisttime) {
        this.persisttime = persisttime;
    }
    
    @Column(name="style", length=30)
    @SearchableProperty
    public String getStyle() {
        return this.style;
    }
    
    public void setStyle(String style) {
        this.style = style;
    }
    
    @Column(name="style_1", length=30)
    @SearchableProperty
    public String getStyle1() {
        return this.style1;
    }
    
    public void setStyle1(String style1) {
        this.style1 = style1;
    }
    
    @Column(name="useby", length=50)
    @SearchableProperty
    public String getUseby() {
        return this.useby;
    }
    
    public void setUseby(String useby) {
        this.useby = useby;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="sellInfo")
    public Set<FavourateSell> getFavourateSells() {
        return this.favourateSells;
    }
    
    public void setFavourateSells(Set<FavourateSell> favourateSells) {
        this.favourateSells = favourateSells;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        SellInfo pojo = (SellInfo) o;

        if (company != null ? !company.equals(pojo.company) : pojo.company != null) return false;
        if (bugType != null ? !bugType.equals(pojo.bugType) : pojo.bugType != null) return false;
        if (createtime != null ? !createtime.equals(pojo.createtime) : pojo.createtime != null) return false;
        if (description != null ? !description.equals(pojo.description) : pojo.description != null) return false;
        if (logos != null ? !logos.equals(pojo.logos) : pojo.logos != null) return false;
        if (other != null ? !other.equals(pojo.other) : pojo.other != null) return false;
        if (persisttime != null ? !persisttime.equals(pojo.persisttime) : pojo.persisttime != null) return false;
        if (style != null ? !style.equals(pojo.style) : pojo.style != null) return false;
        if (style1 != null ? !style1.equals(pojo.style1) : pojo.style1 != null) return false;
        if (useby != null ? !useby.equals(pojo.useby) : pojo.useby != null) return false;

        return true;
    }

    public int hashCode() {
        int result = 0;
        result = (company != null ? company.hashCode() : 0);
        result = 31 * result + (bugType != null ? bugType.hashCode() : 0);
        result = 31 * result + (createtime != null ? createtime.hashCode() : 0);
        result = 31 * result + (description != null ? description.hashCode() : 0);
        result = 31 * result + (logos != null ? logos.hashCode() : 0);
        result = 31 * result + (other != null ? other.hashCode() : 0);
        result = 31 * result + (persisttime != null ? persisttime.hashCode() : 0);
        result = 31 * result + (style != null ? style.hashCode() : 0);
        result = 31 * result + (style1 != null ? style1.hashCode() : 0);
        result = 31 * result + (useby != null ? useby.hashCode() : 0);

        return result;
    }

    public String toString() {
        StringBuffer sb = new StringBuffer(getClass().getSimpleName());

        sb.append(" [");
        sb.append("id").append("='").append(getId()).append("', ");
        sb.append("company").append("='").append(getCompany()).append("', ");
        sb.append("bugType").append("='").append(getBugType()).append("', ");
        sb.append("createtime").append("='").append(getCreatetime()).append("', ");
        sb.append("description").append("='").append(getDescription()).append("', ");
        sb.append("logos").append("='").append(getLogos()).append("', ");
        sb.append("other").append("='").append(getOther()).append("', ");
        sb.append("persisttime").append("='").append(getPersisttime()).append("', ");
        sb.append("style").append("='").append(getStyle()).append("', ");
        sb.append("style1").append("='").append(getStyle1()).append("', ");
        sb.append("useby").append("='").append(getUseby()).append("', ");
        
        sb.append("]");
      
        return sb.toString();
    }

}
